import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class Demo6 {
    public static void main(String[] args) throws IOException {
        try(InputStream stream=new FileInputStream("./text.txt")) {
            byte[] buffer=new byte[1024];
            //b表示实际读到的字节数
            int b= stream.read(buffer);
            for (int i = 0; i < b; i++) {
                System.out.printf("0x%x\n",buffer[i]);
            }
        }
    }
}
